package org.ztest.service;

import java.util.ServiceLoader;

public class ServiceTest
{
    // 在类路径下面放置一个文件：${classpath}/META-INF/services/${full qualified interface name}
    // ServiceLoader就能加载
    public void test()
    {
        ServiceLoader<IMessage> load = ServiceLoader.load(IMessage.class);
        load.forEach(x -> x.showMessage());
    }
}
